﻿function ShowstationName(etype) {
    if (etype == "label") { $("#CBstationname").prop("checked", !$("#CBstationname").prop("checked")); }
    if ($("#CBstationname").prop("checked")) {
        $("#mymap .BMapLabel").each(function (i) { $(this).show(); });
    }
    else {
        $("#mymap .BMapLabel").each(function (i) { $(this).hide(); });
    }
}

function getBoundary(city) {
    var bdary = new BMap.Boundary();
    bdary.get(city, function (rs) {       //获取行政区域

        var count = rs.boundaries.length; //行政区域的点有多少个
        if (count == 0) {
            return;
        }
        var pointArray = [];
        for (var i = 0; i < count; i++) {
            ply = new BMap.Polygon(rs.boundaries[i], { strokeWeight: 2, strokeColor: "#22FF00", fillOpacity: 0, fillColor: "#FFEEEE" }); //建立多边形覆盖物
            map.addOverlay(ply);  //添加覆盖物
            pointArray = pointArray.concat(ply.getPath());
        }
        map.setViewport(pointArray);    //调整视野                 
    });
}
$.extend($.fn.tree.methods, {
    getLevel: function (jq, target) {
        var l = $(target).parentsUntil("ul.tree", "ul");
        return l.length + 1;
    }
});
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  //匹配目标参数
    if (r != null) return unescape(r[2]); return null; //返回参数值
}
